﻿Public Class fPlanes
    Dim DaPlanes As lbGlobalcom.dsProductosTableAdapters.PRO_PLANESTableAdapter

    Private Sub btnCargar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCargar.Click
        Try
            If DsProductos.PRO_PLANES.GetChanges IsNot Nothing Then
                If MessageBox.Show("Hay cambios pendientes por salvar, desea salvarlos", "Cambios pendientes", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
                    PRO_PLANESBindingNavigatorSaveItem.PerformClick()
                End If
            End If
            DaPlanes.Fill(DsProductos.PRO_PLANES)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub fPlanes_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            DaPlanes = New lbGlobalcom.dsProductosTableAdapters.PRO_PLANESTableAdapter
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub PRO_PLANESBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PRO_PLANESBindingNavigatorSaveItem.Click
        Try
            DaPlanes.Update(DsProductos.PRO_PLANES)
            MessageBox.Show("Se salvarón registros con exito", "Salvar Registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub PRO_PLANESDataGridView_UserDeletedRow(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowEventArgs) Handles PRO_PLANESDataGridView.UserDeletedRow
        Try
            DaPlanes.Update(DsProductos.PRO_PLANES)
            MessageBox.Show("Se elimino registro con exito", "Salvar Registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try


    End Sub

    Private Sub PRO_PLANESDataGridView_UserDeletingRow(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowCancelEventArgs) Handles PRO_PLANESDataGridView.UserDeletingRow
        If MessageBox.Show("Esta seguro que desea eliminar este registro", "Elimina Registro", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.No Then
            e.Cancel = True
        End If
    End Sub
End Class